/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Johnny
 */
@Entity
@Table(catalog = "celulares", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Deuda.findAll", query = "SELECT d FROM Deuda d"),
    @NamedQuery(name = "Deuda.findByIdDeuda", query = "SELECT d FROM Deuda d WHERE d.idDeuda = :idDeuda"),
    @NamedQuery(name = "Deuda.findByValor", query = "SELECT d FROM Deuda d WHERE d.valor = :valor"),
    @NamedQuery(name = "Deuda.findByFechaVencimiento", query = "SELECT d FROM Deuda d WHERE d.fechaVencimiento = :fechaVencimiento"),
    @NamedQuery(name = "Deuda.findByEstado", query = "SELECT d FROM Deuda d WHERE d.estado = :estado"),
    @NamedQuery(name = "Deuda.findByCedulaCliente", query = "SELECT d FROM Deuda d WHERE d.cedulaCliente = :cedulaCliente")})
public class Deuda
  implements Serializable
{
  private static final long serialVersionUID = 1L;

  @Id
  @GeneratedValue(strategy=GenerationType.IDENTITY)
  @Basic(optional=false)
  @Column(nullable=false)
  private Integer idDeuda;

  @Column(precision=22)
  private Double valor;

  @Column(name="fecha_vencimiento")
  @Temporal(TemporalType.DATE)
  private Date fechaVencimiento;

  @Lob
  @Column(length=65535)
  private String concepto;
  private Integer estado;

  @JoinColumn(name="cedula_cliente", referencedColumnName="cedula", nullable=false)
  @ManyToOne(optional=false)
  private Cliente cedulaCliente;

  public Deuda()
  {
  }

  public Deuda(Integer idDeuda)
  {
    this.idDeuda = idDeuda;
  }

  public Integer getIdDeuda() {
    return this.idDeuda;
  }

  public void setIdDeuda(Integer idDeuda) {
    this.idDeuda = idDeuda;
  }

  public Double getValor() {
    return this.valor;
  }

  public void setValor(Double valor) {
    this.valor = valor;
  }

  public Date getFechaVencimiento() {
    return this.fechaVencimiento;
  }

  public void setFechaVencimiento(Date fechaVencimiento) {
    this.fechaVencimiento = fechaVencimiento;
  }

  public String getConcepto() {
    return this.concepto;
  }

  public void setConcepto(String concepto) {
    this.concepto = concepto;
  }

  public Integer getEstado() {
    return this.estado;
  }

  public void setEstado(Integer estado) {
    this.estado = estado;
  }

  public Cliente getCedulaCliente() {
    return this.cedulaCliente;
  }

  public void setCedulaCliente(Cliente cedulaCliente) {
    this.cedulaCliente = cedulaCliente;
  }

  public int hashCode()
  {
    int hash = 0;
    hash += (this.idDeuda != null ? this.idDeuda.hashCode() : 0);
    return hash;
  }

  public boolean equals(Object object)
  {
    if (!(object instanceof Deuda)) {
      return false;
    }
    Deuda other = (Deuda)object;
    if (((this.idDeuda == null) && (other.idDeuda != null)) || ((this.idDeuda != null) && (!this.idDeuda.equals(other.idDeuda)))) {
      return false;
    }
    return true;
  }

  public String toString()
  {
    return "com.mycompany.entidades.Deuda[ idDeuda=" + this.idDeuda + " ]";
  }
}